package jrpc

import (
	"context"
	"encoding/json"
	"fmt"

	"github.com/osamingo/jsonrpc/v2"
	"github.com/zeromicro/go-zero/core/logc"
)

func RegisterMethod() {
	Register(&{{.upperStartCamelObject}}InsertFunc{})
}

type {{.upperStartCamelObject}}InsertParams struct {
	*{{.upperStartCamelObject}}
}

type {{.upperStartCamelObject}}InsertResult struct {
}

type {{.upperStartCamelObject}}InsertFunc struct {
	{{.upperStartCamelObject}}InsertParams
	{{.upperStartCamelObject}}InsertResult
}

func (t *{{.upperStartCamelObject}}InsertFunc) Name() string {
	return fmt.Sprintf("%s.%s", {{.table}}, "Insert")
}

func (t *{{.upperStartCamelObject}}InsertFunc) ServeJSONRPC(c context.Context, params *json.RawMessage) (result any, err *jsonrpc.Error) {
	logc.Infof(c, "%s( %v )", t.Name(), *params)
	return nil, nil
}

func (t *{{.upperStartCamelObject}}InsertFunc) Params() any {
	return t.{{.upperStartCamelObject}}InsertParams
}

func (t *{{.upperStartCamelObject}}InsertFunc) Result() any {
	return t.{{.upperStartCamelObject}}InsertResult
}
